package com.cloud.securityoauth2jwtserver;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//https://juejin.im/post/5dc2bec6f265da4d4f65bebe
@RestController
public class IndexController {
    @GetMapping("/user/getCurrentUser")
    public Object get(Authentication authentication){
        return authentication.getPrincipal();
    }

    @GetMapping("/user")
    public Authentication getUser(Authentication authentication) {
        return authentication;
    }
    @GetMapping("")
    public Authentication seccess(Authentication authentication) {
        return authentication;
    }

}
